<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>
<div id="box2"></div>
<script type="text/javascript">
    var date = new Date();
    var box2 = document.getElementById("box2");

    timemove();

    function timemove() {
        var date = new Date();
        var year = date.getFullYear();
        var mth = date.getMonth() + 1;
        var d = date.getDate();
        var h = date.getHours();
        var m = date.getMinutes();
        var s = date.getSeconds();
        var week = date.getDate();

        var time = "现在是" + year + "年" + fn(mth) + "月" + fn(d) + "日" + fn(h) + ":" + fn(m) + ":" + fn(s);

        function fn(str) {
            str < 10 ? str = "0" + str : str;
            return str;
        }

        setInterval(timemove, 1000);
        box2.innerHTML = time;
    }
</script>
</body>
</html>